<!--
 * @Descripttion: 
 * @Version: 
 * @Author: gaohj
 * @Date: 2023-01-09 15:05:25
 * @LastEditors: 
 * @LastEditTime: 2023-01-09 15:05:31
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./sina.js"></script>
</head>
<body>
    <script>
        // 先将json 转成js数据格式 

        var res = JSON.parse(alldata);
        // console.log(typeof res);
       // 城市 确诊人数  新增人数 
    //    for(var k in res){
    //         console.log(k);
    //    } 
    // console.log(res['data']);
    // 1.res['data']  对象
    // 2. res['data']['list']   数组
    // console.log(res['data']['list'] instanceof Array);
    //一个大数组 存放所有的城市的对象
    // 每个城市一个新对象 
    var mydata = [];
    res['data']['list'].forEach(function (item) {
        // console.log(item); 数组的每个元素是对象
        // 现存  累积 死亡 治愈 
        for(var k in item){
            var obj = {};
            obj['city'] = item['name'];
            obj['xiancun'] = item['econNum'];
            obj['value'] = item['value'];
            obj['deathNum'] = item['deathNum'];
            obj['zhiyu'] = item['cureNum'];
        }
            mydata.push(obj);
    });

    // console.log(mydata);
    for(var i=0;i<mydata.length-1;i++){
        for(var j=0;j<mydata.length-1-i;j++){
            if(parseInt(mydata[j]['value'])<parseInt(mydata[j+1]['value'])){
                    var temp = mydata[j];
                    mydata[j] = mydata[j+1];
                    mydata[j+1] = temp;

            }
        }
    }
    console.log(mydata.slice(0,10));

    </script>
</body>
</html>